Skip to content

feat: Add delegate filter param's to account_tx RPC - #2827

Open
PeterChen13579 wants to merge 19 commits into
XRPLF:developfrom
PeterChen13579:fix-delegate-filter
Open

feat: Add delegate filter param's to account_tx RPC#2827
PeterChen13579 wants to merge 19 commits into
XRPLF:developfrom
PeterChen13579:fix-delegate-filter

Conversation

@PeterChen13579

@PeterChen13579 PeterChen13579 commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

This PR adds the ability to filter account_tx results based on transaction delegation. This is useful for scenarios where one account (the delegatee) signs and submits a transaction on behalf of another account (the delegator).

New Request Parameter:

"delegate": {
     "delegate_filter": "actor" or "authorizor",
     "counter_party": "account_address" 
}

Example: If User A submits a transaction to C on behalf of B:
User B (The account holder) can query with delegate_filter: "actor" to find transactions signed by others (like User A).
User A (The signer) can query with delegate_filter: "authorizer" to find transactions they signed for others (like User B).
The counter_party field can be used in either case to filter by a specific valid address

@PeterChen13579 PeterChen13579 changed the title feat: add delegate filter param's to account_tx RPC feat: Add delegate filter param's to account_tx RPC Dec 1, 2025
@codecov

codecov Bot commented Dec 1, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.70115% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/rpc/common/Validators.cpp 95.00% 0 Missing and 1 partial ⚠️
...rc/rpc/filters/impl/DelegateTransactionsFilter.cpp 95.65% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Comment thread src/data/cassandra/CassandraBackendFamily.hpp Outdated
Comment thread src/rpc/RPCHelpers.cpp Outdated
Comment thread src/rpc/common/Types.hpp Outdated
@PeterChen13579

Copy link
Copy Markdown
Collaborator Author

Will wait for Rippled PR to be merged first before merging this one 🫡

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds delegation-aware filtering to the account_tx RPC so callers can request only transactions where the queried account participated via sfDelegate (either as the authorizer/owner or as the actor/signer), optionally constrained to a specific counterparty.

Changes:

  • Introduces delegate request parameter validation/parsing (delegate_filter + optional counter_party) and threads it into AccountTxHandler.
  • Implements DelegateTransactionFilter to include/exclude transactions based on sfDelegate semantics and annotates results with authorizer/actor for matched delegated txns.
  • Adds unit test coverage for parsing, validation, filtering behavior, and handler integration.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/rpc/RPCHelpersTests.cpp Adds unit tests for parseDelegateType / parseDelegateFilter.
tests/unit/rpc/handlers/AccountTxTests.cpp Adds parameter-validation and handler behavior tests for delegate filtering.
tests/unit/rpc/filters/impl/DelegateTransactionsFilterTests.cpp New unit tests for the delegate transaction filter logic.
tests/unit/CMakeLists.txt Registers the new filter test file in the unit test build.
tests/common/util/TestObject.hpp Declares createDelegateBlob test helper.
tests/common/util/TestObject.cpp Implements createDelegateBlob helper to produce delegated tx blobs.
tests/common/util/MockBackendTestFixture.hpp Removes an unused include.
src/rpc/RPCHelpers.hpp Declares delegate parsing helpers.
src/rpc/RPCHelpers.cpp Implements delegate parsing helpers.
src/rpc/handlers/AccountTx.hpp Extends handler input/spec to accept delegate and adds validator.
src/rpc/handlers/AccountTx.cpp Applies delegate filtering in the account_tx loop and adds authorizer/actor output fields (non-binary path).
src/rpc/filters/TransactionFilter.hpp Introduces a filter interface and FilterResult struct.
src/rpc/filters/impl/DelegateTransactionsFilter.hpp Declares DelegateTransactionFilter.
src/rpc/filters/impl/DelegateTransactionsFilter.cpp Implements delegation-based transaction matching.
src/rpc/common/Validators.hpp Declares delegateValidator.
src/rpc/common/Validators.cpp Implements delegate parameter validation (required delegate_filter, optional valid-account counter_party).
src/rpc/common/Types.hpp Adds DelegateFilter request type.
src/rpc/CMakeLists.txt Adds the new filter implementation to the rpc target sources.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rpc/filters/impl/DelegateTransactionsFilter.cpp Outdated
PeterChen13579 and others added 2 commits July 29, 2026 11:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@godexsoft godexsoft left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some small things. Overall PR looks good!
One more thing that you can try to do is to find and remove/simplify comments that are too verbose or unnecessary - i have seen some on the way through this PR.

@@ -0,0 +1,85 @@
//------------------------------------------------------------------------------

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer add these banners

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -0,0 +1,54 @@
//------------------------------------------------------------------------------

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

boost::json::value_to<std::string>(jsonObject.at("tx_type"));
}

if (jsonObject.contains(JS(delegate))) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably can do without the curlies here?

@@ -0,0 +1,212 @@
//------------------------------------------------------------------------------

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants